using System;
using System.Collections.Generic;
using System.Text;
using Elte.SqlSpIdx;
using Elte.SqlSpIdx.Parser;
using Elte.SqlSpIdx.Converters;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System.Drawing;

namespace SpIdxTest
{
    class Program
    {


        static void test()
        {
            try
            {

                SqlInt32 s = Elte.SqlSpIdx.Converters.VectorConverter.VectorSize(Elte.SqlSpIdx.Converters.VectorConverter.Vector_3(1, 3, 5));
                SqlConnectionStringBuilder csb = new SqlConnectionStringBuilder();
                csb.DataSource = @".";
                csb.InitialCatalog = "spatial";

                csb.IntegratedSecurity = true;

                Elte.SqlSpIdx.Constants.MyConnectionString = csb.ToString();
                IEnumerable<object[]> I = Elte.SqlSpIdx.Core.SpatialQueryGeneral(null, "k1", "distance(cx=0.545988,cy=-0.837617,cz=-0.0171898)<660.15", "", true);
                IEnumerator<object[]> I2 = I.GetEnumerator();

                Elte.SqlSpIdx.Core.SpatialQuery("str( 75094092979109888 ,18),       147,        -1,         1, avg(ra) as avra, avg(dec) as avdec, avg(z), count(1)", "k1", "distance(cx=0.545988,cy=-0.837617,cz=-0.0171898)<0.15", "");
                // Elte.SqlSpIdx.Core.SpatialQuery("cx,cy", "Kdindex2", "distance(cx=1,cy=0,cz=0)<1.1", "");
                // Elte.SqlSpIdx.SQLmethods.CreateIndex("Kdindex", "dr5qsocatalog", "cx,cy,cz");
                //Elte.SqlSpIdx.Core.Createindex("K1", "mytable","x,y");
                //Elte.SqlSpIdx.SQLmethods.CreateIndex("none", "N1", "teszt", "Trainingset", "Miles", "N1_Cell", "dbo.Vector_4(u_g,g_r,r_i,i_z)", "u_g,g_r,r_i,i_z", "whitening=false,size=3,treedepth=3,binarydatacolumn=true,count=50");
                //Elte.SqlSpIdx.SQLmethods.CreateIndex("kdtree", "K1", "teszt1", "Trainingset", "Miles", "K1_Cell", "dbo.Vector_4(u_g,g_r,r_i,i_z)", "u_g,g_r,r_i,i_z", "whitening=false,size=3,treedepth=3,binarydatacolumn=true,count=50");
                //Elte.SqlSpIdx.SQLmethods.CreateIndex("grid", "G1", "teszt2", "Trainingset", "Miles", "G1_Cell", "dbo.Vector_4(u_g,g_r,r_i,i_z)", "u_g,g_r,r_i,i_z", "whitening=false,size=3,treedepth=3,binarydatacolumn=true,count=50");
                //Elte.SqlSpIdx.SQLmethods.CreateIndex("grid", "G1", "test2", "source", "id", "G1", "dbo.Vector_2(x,y)", "x,y", "size=12,treedepth=12");
                //Elte.SqlSpIdx.SQLmethods.CreateIndex("kdtree", "K1", "test1", "source", "id", "K1", "dbo.Vector_2(x,y)", "x,y", "whitening=false,size=12,treedepth=12");
                //Elte.SqlSpIdx.SQLmethods.CreateIndex("kdtree", "K1", "test1", "vol_lim_tmp", "id", "K1", "dbo.Vector_3(xx,yy,zz)", "xx,yy,zz", "whitening=false,size=5,treedepth=5");
                // Elte.SqlSpIdx.SQLmethods.SpatialQuery("xx,yy", "K1", "NN(xx=0,yy=0,zz=0,N=4)", "");
            }
            catch (Exception ex)
            {
                Core.Log(ex.Message.ToString());
            }

            Console.ReadLine();
        }

        static void Main(string[] args)
        {
            test();

        }


    }
}
